package com.rc.saas.tenant.common.utils;



/**
 * @author frog
 * @date 2021/7/29
 */
public class GenerateQrcode {

    /**
     * 链接前缀
     **/
    private static String prefix = "hlht://";
    // 运营商标识（OperatorID）/组织机构代码(企业名称，营业执照)
    private static String OperatorID = ".914401153/";
    /**
     * 图片默认存放地址
     **/
    private static String addressMomory = "C:/qrcode";

    //saas生成二维码
    public static void saasPileNoCode() {
        String head = "115344";
        for (int j = 0; j < 12; j++) {
            String lastNo = "115344000061";
            head = lastNo.substring(0, 6);
            lastNo = lastNo.substring(6, 11);
            int no = Integer.valueOf(lastNo);
            no += 1 + j;
            String s = String.format("%05d", no);
            //双枪
            String text = null;
            for (int i = 1; i < 3; i++) {
                lastNo = head + s + i;
                text = prefix + lastNo + OperatorID;
                System.out.println(lastNo);
                try {
                    QRCodeUtil2.encode(text, "", addressMomory, "电枪编号" + lastNo, true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }

    //旧生成二维码
    public static void pileNoCode() {
        String head = "19";
        for (int j = 0; j < 1; j++) {
            String lastNo = "19000701";
            lastNo = lastNo.substring(2, 7);
            int no = Integer.valueOf(lastNo);
            no += 1 + j;
            String s = String.format("%05d", no);
            //双枪
            String text = null;
            for (int i = 1; i < 3; i++) {
                lastNo = head + s + i;
                text = prefix + lastNo + OperatorID;
                System.out.println(lastNo);
                try {
                    QRCodeUtil2.encode(text, "", addressMomory, "电枪编号" + lastNo, true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }


}
